package com.main;

import java.util.HashSet;
import java.util.UUID;

import com.qs.dao.ChannelDAO;
import com.qs.dao.FeedDAO;
import com.qs.dao.UserDAO;
import com.qs.entities.Channel;
import com.qs.entities.Feed;
import com.qs.entities.User;
import com.qs.services.FeedService;
import com.qs.utils.EncryptionUtils;

public class HibernateTest {

	public static void main(String[] args) {
		try{
			
			UserDAO userDao = new UserDAO();
			//FeedDAO feedDao = new FeedDAO();
			//FeedService feedService = new FeedService();
			//System.out.println(feedService.getFeeds(0, 5));
			
			//ChannelDAO channelDao = new ChannelDAO();
			//Channel channel = channelDao.findById(1);
			
			Channel channel = new Channel();
			channel.channelId = 1;
			
			
			System.out.println("##Begin Transaction##");
			User user 		= new User();
			user.userId  	= UUID.randomUUID().toString();
			user.firstName 	= "New";
			user.lastName 	= "Abbasi";
			user.screenName = "Terry";
			user.email 		= "terry@gmail.com";
			user.password 	= EncryptionUtils.encryptPassword("P@ssw0rd");
			user.address 	= "35995 Fremont Blvd, Apt130, Fremont CA";
			user.phone 		= "510-304-7410";
			user.channels	= new HashSet<Channel>();
			user.channels.add(channel);
			userDao.save(user);
			
			//Feed feed1 			= new Feed();
			//feed1.feedId		= UUID.randomUUID().toString();
			//feed1.user		 	= new User("cdabcaec-c326-47a0-8830-baa62850a9ab");
			//feed1.text 			= "Mistakes are a part of being human. Appreciate your mistakes for what they are: precious life lessons that can only be learned the hard way. Unless it's a fatal mistake, which, at least, others can learn from";
			//feed1.language 		= "en";
			
			//Feed feed2			= new Feed();
			//feed2.feedId		= UUID.randomUUID().toString();
			//feed2.user		 	= new User("cdabcaec-c326-47a0-8830-baa62850a9ab");
			//feed2.text 			= "Do not fear mistakes. You will know failure. Continue to reach out";
			//feed2.language 		= "en";
			
			//feedDao.save(feed1);
			
			//feedDao.save(feed2);
			
			System.out.println("##Commit Transaction##");
			
		}
		catch(Exception exc){
			exc.printStackTrace(System.err);
			
		}
		
		
	}

}
